#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn=7500, a=84, b=48, mods=2019201997;

int main() {
  freopen("walk.in", "r", stdin);
  freopen("walk.out", "w", stdout);

  static int dis[maxn+1], ans[maxn+1], que[maxn+1];
  static bool book[maxn+1];
  int n, k;
  scanf("%d %d", &n, &k);
  que[1] = 1, book[1]=true;
  for (int i=1; i<n; i++) {
    int o=que[i], nextp=0;
    for (int j=1; j<=n; j++) {
      if (!book[j]) {
        dis[j] = max(dis[j], j<o ? j*a+o*b : o*a+j*b);
        if (dis[j]>dis[nextp]) {
          nextp = j;
          ans[i] = dis[j];
        }
      }
    }
    book[nextp]=true;
    que[i+1] = nextp;
  }

  sort(ans+1, ans+n);

  printf("%d", mods-ans[k-1]);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
